export function isObject(target) {
    if (!target) return false
    return typeof target === 'object'
}
export function isArray (target) {
    return isObject(target) && target instanceof Array
}
export function remove(arr, item) {
    if (!arr) return
    const index = arr.indexOf(item)
    if(index > -1) return arr.splice(index, 1)
}
export function def (obj, key, val, enumerable?) {
    Object.defineProperty(obj, key, {
        configurable: true,
        enumerable: !!enumerable,
        value: val,
        writable: true
    })
}
export function observe (value, asRootData) {
    if (!isObject(value)) return
    let ob;
    if(hasOwn(value, '__ob__') && value.__ob__ instanceof Observer){
        ob = value.__ob__
    } else {
        ob = new Observer(value)
    }
    return ob
}